#ifndef     __VIDEO_WIDGET_H
#define     __VIDEO_WIDGET_H

#include <QLabel>
#include <SDL2/SDL.h>
#include "../utils/image.h"
#include "./playex.h"

class VideoWidget : public QLabel {

public:
    VideoWidget(QWidget *parent = nullptr);
    ~VideoWidget();

    void play(const QString &file_path);
    void play_files(const QStringList &file_paths);

protected:
    void resizeEvent(QResizeEvent *event) override;

private:
    void play_next();
    void refresh(ImageWrap &&image);
    QStringList m_files;
    int m_file_index = 0;
    bool m_play_flag = false;

    std::unique_ptr<PlayEx> m_playex = nullptr;
    std::thread m_play_task;
};


#endif
